import { createApp } from 'vue'
import '@/assets/css/index.less'

import App from './App.vue'
import router from './router'
import { pinia } from '@/utils'
import { initApp, initDic, initFont } from './config'

import UI from './components'

import { getSetting } from '@/settings'
import { setCssVariable } from '@/config'
const { themeConfig } = getSetting()
setCssVariable(themeConfig)
initFont()

const app = createApp(App)
app.use(pinia)
app.use(router)
app.use(UI)

initApp(app)

router.isReady().then(async () => {
  try {
    try {
      await initDic()
    } catch (e) {
      console.log('initDic-error', e)
    }
  } catch (e) {
    console.log('router-error', e)
  } finally {
    app.mount('#app')
  }
})
